local M = {}

local m_level = 1

local function randArr(arr)
	for i=#arr,1,-1 do
		local idx = math.random(1,i)
		local tmp = arr[idx]
		arr[idx] = arr[i]
		arr[i] = tmp
	end
end

function M:resetLevel()
	m_level = 1
end

function M:levelUp()
	m_level = m_level + 1
end

function M:getLevel()
	return m_level
end

function M:getLevelData()
	local min = 4
	local max = min+math.floor(m_level/2)
	local num = math.random(min,max)
	num = num<10 and num or 10
	local data = {}
	for i=1,16 do
		if i<=num then
			data[i] = 1
		else
			data[i] = 0
		end
	end
	randArr(data)
	return data
end

function M:getOperateTime()
	local time = 10
	return time
end

function M:getShowTime()
	local time = 1.6
	return time
end

return M